Update to rust master
authorAlex Crichton <alex@alexcrichton.com>
Mon, 3 Nov 2014 01:54:06 +0000 (17:54 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 5 Nov 2014 18:06:15 +0000 (10:06 -0800)
18 files changed:
.travis.install.deps.sh
Cargo.lock
src/bin/cargo.rs
src/cargo/core/registry.rs
src/cargo/core/resolver/mod.rs
src/cargo/core/source.rs
src/cargo/lib.rs
src/cargo/ops/cargo_compile.rs
src/cargo/ops/cargo_rustc/context.rs
src/cargo/ops/cargo_rustc/fingerprint.rs
src/cargo/ops/cargo_rustc/job_queue.rs
src/cargo/ops/cargo_rustc/mod.rs
src/cargo/sources/git/source.rs
src/cargo/sources/registry.rs
src/cargo/util/config.rs
src/cargo/util/dependency_queue.rs
src/cargo/util/graph.rs
src/etc/dl-snapshot.py

index bece34213fca5424c2efc139e4e75aa703925f64..f9eeb15225920d1e6afff21ef71910a8ce548b15 100755 (executable)
@@ -52,9 +52,9 @@ if [ -z "${windows}" ]; then
 else
     rm -rf rustc *.exe
     if [ "${BITS}" = "64" ]; then
-        triple=x86_64-w64-mingw32
+        triple=x86_64-pc-windows-gnu
     else
-        triple=i686-w64-mingw32
+        triple=i686-pc-windows-gnu
     fi
     curl -O http://$host/dist/rust-nightly-$triple.exe
     innounp -y -x rust-nightly-$triple.exe
index 2db9da27b1aad78865efac0d31dcc2a1acd9ef4f..e1ea26d0a3f5e97fbaf9e7b9d2df0448a2402fb0 100644 (file)
@@ -3,7 +3,7 @@ name = "cargo"
 version = "0.0.1-pre"
 dependencies = [
  "curl 0.0.1 (git+https://github.com/alexcrichton/curl-rust?ref=bundle)",
- "docopt 0.6.5 (git+https://github.com/docopt/docopt.rs)",
+ "docopt 0.6.8 (git+https://github.com/docopt/docopt.rs)",
  "flate2 0.0.1 (git+https://github.com/alexcrichton/flate2-rs)",
  "git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs)",
  "glob 0.0.1 (git+https://github.com/rust-lang/glob)",
@@ -18,7 +18,7 @@ dependencies = [
 [[package]]
 name = "curl"
 version = "0.0.1"
-source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#28d4a3d0dde0cde6b6f46fc928656cb251832888"
+source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#b595431adb3ff1ad55e3cff30ee8b0c05d9103a0"
 dependencies = [
  "curl-sys 0.0.1 (git+https://github.com/alexcrichton/curl-rust?ref=bundle)",
  "link-config 0.0.1 (git+https://github.com/alexcrichton/link-config)",
@@ -29,27 +29,27 @@ dependencies = [
 [[package]]
 name = "curl-sys"
 version = "0.0.1"
-source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#28d4a3d0dde0cde6b6f46fc928656cb251832888"
+source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#b595431adb3ff1ad55e3cff30ee8b0c05d9103a0"
 
 [[package]]
 name = "docopt"
-version = "0.6.5"
-source = "git+https://github.com/docopt/docopt.rs#6db6dc0177ea739be9b90f18ab87a674413797a1"
+version = "0.6.8"
+source = "git+https://github.com/docopt/docopt.rs#1b614c83b771b23e95e69d10b4bc04c87ff7eff3"
 
 [[package]]
 name = "encoding"
 version = "0.1.0"
-source = "git+https://github.com/lifthrasiir/rust-encoding#6daaad9f4c0fcde4525821032686090d6426c462"
+source = "git+https://github.com/lifthrasiir/rust-encoding#a739425a3f3174a31fe38c158dcaf22ea1d856f4"
 
 [[package]]
 name = "flate2"
 version = "0.0.1"
-source = "git+https://github.com/alexcrichton/flate2-rs#67be37548937c059370ce272efe1142fbf198d67"
+source = "git+https://github.com/alexcrichton/flate2-rs#31d9253355ba837cd62487b8766bf2be89f334a3"
 
 [[package]]
 name = "git2"
 version = "0.0.1"
-source = "git+https://github.com/alexcrichton/git2-rs#35a0632e92d63de8218675a17cd81e15d0de44b4"
+source = "git+https://github.com/alexcrichton/git2-rs#556e27113a4918cede9b80e447a5ebad524f3357"
 dependencies = [
  "libgit2 0.0.1 (git+https://github.com/alexcrichton/git2-rs)",
  "url 0.1.0 (git+https://github.com/servo/rust-url)",
@@ -68,7 +68,7 @@ source = "git+https://github.com/carllerche/hamcrest-rust.git#998036d000095f72c8
 [[package]]
 name = "libgit2"
 version = "0.0.1"
-source = "git+https://github.com/alexcrichton/git2-rs#35a0632e92d63de8218675a17cd81e15d0de44b4"
+source = "git+https://github.com/alexcrichton/git2-rs#556e27113a4918cede9b80e447a5ebad524f3357"
 dependencies = [
  "libssh2-static-sys 0.0.1 (git+https://github.com/alexcrichton/libssh2-static-sys)",
  "link-config 0.0.1 (git+https://github.com/alexcrichton/link-config)",
@@ -78,7 +78,7 @@ dependencies = [
 [[package]]
 name = "libssh2-static-sys"
 version = "0.0.1"
-source = "git+https://github.com/alexcrichton/libssh2-static-sys#80e71a3021618eb05656c58fb7c5ef5f12bc747f"
+source = "git+https://github.com/alexcrichton/libssh2-static-sys#c0dc19bd7a9096b6c79911f4135cd4fb79962127"
 
 [[package]]
 name = "link-config"
@@ -110,7 +110,7 @@ source = "git+https://github.com/alexcrichton/tar-rs#47d2cc4b09e373a4cc7bee7c71e
 [[package]]
 name = "toml"
 version = "0.1.0"
-source = "git+https://github.com/alexcrichton/toml-rs#71d1689d63ef1af41addef330e314a56e88f48a9"
+source = "git+https://github.com/alexcrichton/toml-rs#78acb5081d57bec85fd51ecb596506b14d17d430"
 
 [[package]]
 name = "url"
index d82d297abce2f1af64425e45a87566106b7ace3d..d0bdc10a9652fa34769c384ee3588604d354395c 100644 (file)
@@ -113,6 +113,7 @@ fn execute(flags: Flags, shell: &mut MultiShell) -> CliResult<Option<()>> {
         s => (flags.arg_args.clone(), s),
     };
     args.insert(0, command.to_string());
+    args.insert(0, os::args()[0].clone());
 
     macro_rules! cmd( ($name:ident) => (
         if command.as_slice() == stringify!($name).replace("_", "-").as_slice() {
index 7f1e6dab0b686592e0d4c1242243e9353b212a46..26e613dae40504021eded2c8fe9b5375f5ad3fa0 100644 (file)
@@ -1,4 +1,5 @@
-use std::collections::hashmap::{HashSet, HashMap, Occupied, Vacant};
+use std::collections::HashSet;
+use std::collections::hash_map::{HashMap, Occupied, Vacant};
 
 use core::{Source, SourceId, SourceMap, Summary, Dependency, PackageId, Package};
 use util::{CargoResult, ChainError, Config, human, profile};
@@ -36,7 +37,7 @@ impl Registry for Vec<Summary> {
 /// operations if necessary) and is ready to be queried for packages.
 pub struct PackageRegistry<'a> {
     sources: SourceMap<'a>,
-    config: &'a mut Config<'a>,
+    config: &'a Config<'a>,
 
     // A list of sources which are considered "overrides" which take precedent
     // when querying for packages.
@@ -70,7 +71,7 @@ enum Kind {
 }
 
 impl<'a> PackageRegistry<'a> {
-    pub fn new<'a>(config: &'a mut Config<'a>) -> PackageRegistry<'a> {
+    pub fn new<'a>(config: &'a Config<'a>) -> PackageRegistry<'a> {
         PackageRegistry {
             sources: SourceMap::new(),
             source_ids: HashMap::new(),
index 462f449272b531efa76927f388c5737275b0be78..03ae387d318e9a69e14f4cd53372058cd398ab3e 100644 (file)
@@ -1,5 +1,6 @@
 use std::cell::RefCell;
-use std::collections::hashmap::{HashMap, HashSet, Occupied, Vacant};
+use std::collections::HashSet;
+use std::collections::hash_map::{HashMap, Occupied, Vacant};
 use std::fmt;
 use std::rc::Rc;
 use semver;
index 3d9a717f1d2b0b5a51bd3530b55bbb3ca3adc4ab..e79555de1fa56557dd41d6e23ed5c76401e37c2a 100644 (file)
@@ -1,6 +1,4 @@
-use std::cmp::Ordering;
-use std::collections::HashMap;
-use std::collections::hashmap::{Values, MutEntries};
+use std::collections::hash_map::{HashMap, Values, MutEntries};
 use std::fmt::{mod, Show, Formatter};
 use std::hash;
 use std::iter;
@@ -185,7 +183,7 @@ impl SourceId {
     }
 
     /// Creates an implementation of `Source` corresponding to this ID.
-    pub fn load<'a>(&self, config: &'a mut Config) -> Box<Source+'a> {
+    pub fn load<'a>(&self, config: &'a Config) -> Box<Source+'a> {
         log!(5, "loading SourceId; {}", self);
         match self.inner.kind {
             GitKind(..) => box GitSource::new(self, config) as Box<Source+'a>,
@@ -319,17 +317,18 @@ impl<S: hash::Writer> hash::Hash<S> for SourceId {
     }
 }
 
-pub struct SourceMap<'a> {
-    map: HashMap<SourceId, Box<Source+'a>>
+pub struct SourceMap<'src> {
+    map: HashMap<SourceId, Box<Source+'src>>
 }
 
-pub type Sources<'a> = Values<'a, SourceId, Box<Source+'a>>;
-pub type SourcesMut<'a> = iter::Map<'static, (&'a SourceId, &'a mut Box<Source+'a>),
-                                    &'a mut Source+'a,
-                                    MutEntries<'a, SourceId, Box<Source+'a>>>;
+pub type Sources<'a, 'src> = Values<'a, SourceId, Box<Source+'src>>;
+pub type SourcesMut<'a, 'src> = iter::Map<'static, (&'a SourceId,
+                                                  &'a mut Box<Source+'src>),
+                                    &'a mut Source+'src,
+                                    MutEntries<'a, SourceId, Box<Source+'src>>>;
 
-impl<'a> SourceMap<'a> {
-    pub fn new() -> SourceMap<'a> {
+impl<'src> SourceMap<'src> {
+    pub fn new() -> SourceMap<'src> {
         SourceMap {
             map: HashMap::new()
         }
@@ -339,27 +338,27 @@ impl<'a> SourceMap<'a> {
         self.map.contains_key(id)
     }
 
-    pub fn get(&self, id: &SourceId) -> Option<&Source+'a> {
+    pub fn get(&self, id: &SourceId) -> Option<&Source+'src> {
         let source = self.map.find(id);
 
         source.map(|s| {
-            let s: &Source+'a = &**s;
+            let s: &Source+'src = &**s;
             s
         })
     }
 
-    pub fn get_mut(&mut self, id: &SourceId) -> Option<&mut Source+'a> {
+    pub fn get_mut(&mut self, id: &SourceId) -> Option<&mut Source+'src> {
         self.map.find_mut(id).map(|s| {
-            let s: &mut Source+'a = &mut **s;
+            let s: &mut Source+'src = &mut **s;
             s
         })
     }
 
-    pub fn get_by_package_id(&self, pkg_id: &PackageId) -> Option<&Source+'a> {
+    pub fn get_by_package_id(&self, pkg_id: &PackageId) -> Option<&Source+'src> {
         self.get(pkg_id.get_source_id())
     }
 
-    pub fn insert(&mut self, id: &SourceId, source: Box<Source+'a>) {
+    pub fn insert(&mut self, id: &SourceId, source: Box<Source+'src>) {
         self.map.insert(id.clone(), source);
     }
 
@@ -367,27 +366,27 @@ impl<'a> SourceMap<'a> {
         self.map.len()
     }
 
-    pub fn sources(&'a self) -> Sources<'a> {
+    pub fn sources<'a>(&'a self) -> Sources<'a, 'src> {
         self.map.values()
     }
 
-    pub fn sources_mut(&'a mut self) -> SourcesMut<'a> {
-        self.map.iter_mut().map(|(_, v)| { let s: &mut Source+'a = &mut **v; s })
+    pub fn sources_mut<'a>(&'a mut self) -> SourcesMut<'a, 'src> {
+        self.map.iter_mut().map(|(_, v)| &mut **v)
     }
 }
 
 /// List of `Source` implementors. `SourceSet` itself implements `Source`.
-pub struct SourceSet<'a> {
-    sources: Vec<Box<Source+'a>>
+pub struct SourceSet<'src> {
+    sources: Vec<Box<Source+'src>>
 }
 
-impl<'a> SourceSet<'a> {
-    pub fn new(sources: Vec<Box<Source+'a>>) -> SourceSet<'a> {
+impl<'src> SourceSet<'src> {
+    pub fn new(sources: Vec<Box<Source+'src>>) -> SourceSet<'src> {
         SourceSet { sources: sources }
     }
 }
 
-impl<'a> Registry for SourceSet<'a> {
+impl<'src> Registry for SourceSet<'src> {
     fn query(&mut self, name: &Dependency) -> CargoResult<Vec<Summary>> {
         let mut ret = Vec::new();
 
@@ -399,7 +398,7 @@ impl<'a> Registry for SourceSet<'a> {
     }
 }
 
-impl<'a> Source for SourceSet<'a> {
+impl<'src> Source for SourceSet<'src> {
     fn update(&mut self) -> CargoResult<()> {
         for source in self.sources.iter_mut() {
             try!(source.update());
index 800f2d59d043a2e0bf1b1e2a09af86292e750033..54269d2b05a6bdf85a28688cff529c7497d4ef06 100644 (file)
@@ -30,6 +30,7 @@ use std::os;
 use std::io::stdio::{stdout_raw, stderr_raw};
 use std::io::{mod, stdout, stderr};
 use serialize::{Decoder, Encoder, Decodable, Encodable, json};
+use docopt::Docopt;
 
 use core::{Shell, MultiShell, ShellConfig};
 use term::color::{BLACK};
@@ -131,9 +132,7 @@ pub fn call_main_without_stdin<'a,
 fn process<'a, V: Encodable<json::Encoder<'a>, io::IoError>>(
                callback: |&[String], &mut MultiShell| -> CliResult<Option<V>>) {
     let mut shell = shell(true);
-    let mut args = os::args();
-    args.remove(0);
-    process_executed(callback(args.as_slice(), &mut shell), &mut shell)
+    process_executed(callback(os::args().as_slice(), &mut shell), &mut shell)
 }
 
 pub fn process_executed<'a,
@@ -222,18 +221,12 @@ pub fn version() -> String {
 fn flags_from_args<'a, T>(usage: &str, args: &[String],
                           options_first: bool) -> CliResult<T>
                           where T: Decodable<docopt::Decoder, docopt::Error> {
-    let args = args.iter().map(|a| a.as_slice()).collect::<Vec<&str>>();
-    let config = docopt::Config {
-        options_first: options_first,
-        help: true,
-        version: Some(version()),
-    };
-    let value_map = try!(docopt::docopt_args(config, args.as_slice(),
-                                             usage).map_err(|e| {
-        let code = if e.fatal() {1} else {0};
-        CliError::from_error(e, code)
-    }));
-    value_map.decode().map_err(|e| {
+    let docopt = Docopt::new(usage).unwrap()
+                                   .options_first(options_first)
+                                   .argv(args.iter().map(|s| s.as_slice()))
+                                   .help(true)
+                                   .version(Some(version()));
+    docopt.decode().map_err(|e| {
         let code = if e.fatal() {1} else {0};
         CliError::from_error(e, code)
     })
index 6d7568f7037d19ca9dc6af1233a9397c2e78402d..2947efa4b563f39c057198521a16ca1c82d49c6c 100644 (file)
@@ -83,11 +83,11 @@ pub fn compile_pkg(package: &Package, options: &mut CompileOptions)
     let user_configs = try!(config::all_configs(os::getcwd()));
     let override_ids = try!(source_ids_from_config(&user_configs,
                                                    package.get_root()));
+    let config = try!(Config::new(*shell, jobs, target.clone()));
 
     let (packages, resolve_with_overrides, sources) = {
-        let mut config = try!(Config::new(*shell, jobs, target.clone()));
         let rustc_host = config.rustc_host().to_string();
-        let mut registry = PackageRegistry::new(&mut config);
+        let mut registry = PackageRegistry::new(&config);
 
         // First, resolve the package's *listed* dependencies, as well as
         // downloading and updating all remotes and such.
@@ -138,13 +138,12 @@ pub fn compile_pkg(package: &Package, options: &mut CompileOptions)
 
     let ret = {
         let _p = profile::start("compiling");
-        let mut config = try!(Config::new(*shell, jobs, target));
-        try!(scrape_target_config(&mut config, &user_configs));
+        try!(scrape_target_config(&config, &user_configs));
 
         try!(ops::compile_targets(env.as_slice(), targets.as_slice(), to_build,
                                   &PackageSet::new(packages.as_slice()),
                                   &resolve_with_overrides, &sources,
-                                  &mut config))
+                                  &config))
     };
 
     return Ok(ret);
@@ -174,7 +173,7 @@ fn source_ids_from_config(configs: &HashMap<String, config::ConfigValue>,
     }).map(|p| SourceId::for_path(&p)).collect()
 }
 
-fn scrape_target_config(config: &mut Config,
+fn scrape_target_config(config: &Config,
                         configs: &HashMap<String, config::ConfigValue>)
                         -> CargoResult<()> {
     let target = match configs.find_equiv("target") {
index 4163b3f604f2d8e13a6aaf590598d8e0ed86a670..0ea5dc8f8fcb0b2021769e954f45b8041a5732d1 100644 (file)
@@ -1,5 +1,5 @@
-use std::collections::{HashMap, HashSet};
-use std::collections::hashmap::{Occupied, Vacant};
+use std::collections::HashSet;
+use std::collections::hash_map::{HashMap, Occupied, Vacant};
 use std::str;
 
 use core::{SourceMap, Package, PackageId, PackageSet, Resolve, Target};
@@ -16,8 +16,8 @@ pub enum PlatformRequirement {
     PlatformPluginAndTarget,
 }
 
-pub struct Context<'a, 'b> {
-    pub config: &'b mut Config<'b>,
+pub struct Context<'a, 'b: 'a> {
+    pub config: &'b Config<'b>,
     pub resolve: &'a Resolve,
     pub sources: &'a SourceMap<'b>,
     pub compilation: Compilation,
@@ -33,9 +33,9 @@ pub struct Context<'a, 'b> {
     requirements: HashMap<(&'a PackageId, &'a str), PlatformRequirement>,
 }
 
-impl<'a, 'b> Context<'a, 'b> {
-    pub fn new(env: &'a str, resolve: &'a Resolve, sources: &'a SourceMap,
-               deps: &'a PackageSet, config: &'b mut Config<'b>,
+impl<'a, 'b: 'a> Context<'a, 'b> {
+    pub fn new(env: &'a str, resolve: &'a Resolve, sources: &'a SourceMap<'b>,
+               deps: &'a PackageSet, config: &'b Config<'b>,
                host: Layout, target: Option<Layout>,
                root_pkg: &Package)
                -> CargoResult<Context<'a, 'b>> {
@@ -95,8 +95,12 @@ impl<'a, 'b> Context<'a, 'b> {
             Some((dylib_parts[0].to_string(), dylib_parts[1].to_string()))
         };
 
-        let exe_suffix = lines.next().unwrap().trim()
-                              .split('-').skip(1).next().unwrap().to_string();
+        let exe_suffix = if error.contains("dropping unsupported crate type `bin`") {
+            String::new()
+        } else {
+            lines.next().unwrap().trim()
+                 .split('-').skip(1).next().unwrap().to_string()
+        };
         Ok((dylib, exe_suffix.to_string()))
     }
 
index 7313011fdbde8537ea8181e52bc5ea8d29b7a789..135cffeee96a9a19e75a434d4a2cfdba6a4b3bfa 100644 (file)
@@ -1,4 +1,4 @@
-use std::collections::hashmap::{Occupied, Vacant};
+use std::collections::hash_map::{Occupied, Vacant};
 use std::hash::{Hash, Hasher};
 use std::hash::sip::SipHasher;
 use std::io::{fs, File, USER_RWX, BufferedReader};
index 9c1b5f7b81904abf90805301660cb09181dea00a..5097267d91c49c0c07fd5c20f1d1777d3865b7fd 100644 (file)
@@ -1,4 +1,5 @@
-use std::collections::hashmap::{HashMap, HashSet, Occupied, Vacant};
+use std::collections::HashSet;
+use std::collections::hash_map::{HashMap, Occupied, Vacant};
 use term::color::YELLOW;
 
 use core::{Package, PackageId, Resolve, PackageSet};
@@ -57,7 +58,7 @@ type Message = (PackageId, TargetStage, Freshness, CargoResult<()>);
 
 impl<'a, 'b> JobQueue<'a, 'b> {
     pub fn new(resolve: &'a Resolve, packages: &'a PackageSet,
-               config: &mut Config) -> JobQueue<'a, 'b> {
+               config: &Config) -> JobQueue<'a, 'b> {
         let (tx, rx) = channel();
         JobQueue {
             pool: TaskPool::new(config.jobs()),
@@ -98,7 +99,7 @@ impl<'a, 'b> JobQueue<'a, 'b> {
     /// This function will spawn off `config.jobs()` workers to build all of the
     /// necessary dependencies, in order. Freshness is propagated as far as
     /// possible along each dependency chain.
-    pub fn execute(&mut self, config: &mut Config) -> CargoResult<()> {
+    pub fn execute(&mut self, config: &Config) -> CargoResult<()> {
         let _p = profile::start("executing the job graph");
 
         // Iteratively execute the dependency graph. Each turn of this loop will
@@ -154,7 +155,7 @@ impl<'a, 'b> JobQueue<'a, 'b> {
     /// freshness of all upstream dependencies. This function will schedule all
     /// work in `jobs` to be executed.
     fn run(&mut self, pkg: &'a Package, stage: TargetStage, fresh: Freshness,
-           jobs: Vec<(Job, Freshness)>, config: &mut Config) -> CargoResult<()> {
+           jobs: Vec<(Job, Freshness)>, config: &Config) -> CargoResult<()> {
         let njobs = jobs.len();
         let amt = if njobs == 0 {1} else {njobs};
         let id = pkg.get_package_id().clone();
index 34f6d1aa02459b8423d71af915ac857b6bb9040f..146b9d861b09aa0b1740ec231e8a4f79ee462b6f 100644 (file)
@@ -72,7 +72,7 @@ fn uniq_target_dest<'a>(targets: &[&'a Target]) -> Option<&'a str> {
 pub fn compile_targets<'a>(env: &str, targets: &[&'a Target], pkg: &'a Package,
                            deps: &PackageSet, resolve: &'a Resolve,
                            sources: &'a SourceMap,
-                           config: &'a mut Config<'a>)
+                           config: &'a Config<'a>)
                            -> CargoResult<Compilation> {
     if targets.is_empty() {
         return Ok(Compilation::new(pkg))
@@ -405,6 +405,10 @@ fn build_base_args(cx: &Context,
                          .rpath(root_profile.get_rpath())
     }
 
+    if profile.is_plugin() {
+        cmd = cmd.arg("-C").arg("prefer-dynamic");
+    }
+
     if profile.get_opt_level() != 0 {
         cmd = cmd.arg("--opt-level").arg(profile.get_opt_level().to_string());
     }
@@ -474,8 +478,10 @@ fn build_plugin_args(mut cmd: ProcessBuilder, cx: &Context, pkg: &Package,
         }
 
         cmd = opt(cmd, "--target", "", cx.config.target());
-        cmd = opt(cmd, "-C", "ar=", cx.config.ar());
-        cmd = opt(cmd, "-C", "linker=", cx.config.linker());
+        cmd = opt(cmd, "-C", "ar=", cx.config.ar().as_ref()
+                                             .map(|s| s.as_slice()));
+        cmd = opt(cmd, "-C", "linker=", cx.config.linker().as_ref()
+                                                 .map(|s| s.as_slice()));
     }
 
     return cmd;
index 7febd60800d54167e46e7f4a75fc4a880d35a70a..8e6ca61513448b059c4649477ec0d265ac1a4d56 100644 (file)
@@ -20,12 +20,12 @@ pub struct GitSource<'a, 'b:'a> {
     source_id: SourceId,
     path_source: Option<PathSource>,
     rev: Option<GitRevision>,
-    config: &'a mut Config<'b>,
+    config: &'a Config<'b>,
 }
 
 impl<'a, 'b> GitSource<'a, 'b> {
     pub fn new<'a, 'b>(source_id: &SourceId,
-                       config: &'a mut Config<'b>) -> GitSource<'a, 'b> {
+                       config: &'a Config<'b>) -> GitSource<'a, 'b> {
         assert!(source_id.is_git(), "id is not git, id={}", source_id);
 
         let reference = match source_id.git_reference() {
index 01d0a804f036e5d4826b143c291b9426096716c7..e762d9feb4962356f3a54f27c20500cb49f1c2d2 100644 (file)
@@ -184,7 +184,7 @@ pub struct RegistrySource<'a, 'b:'a> {
     checkout_path: Path,
     cache_path: Path,
     src_path: Path,
-    config: &'a mut Config<'b>,
+    config: &'a Config<'b>,
     handle: Option<http::Handle>,
     sources: Vec<PathSource>,
     hashes: HashMap<(String, String), String>, // (name, vers) => cksum
@@ -226,7 +226,7 @@ struct RegistryDependency {
 
 impl<'a, 'b> RegistrySource<'a, 'b> {
     pub fn new(source_id: &SourceId,
-               config: &'a mut Config<'b>) -> RegistrySource<'a, 'b> {
+               config: &'a Config<'b>) -> RegistrySource<'a, 'b> {
         let hash = hex::short_hash(source_id);
         let ident = source_id.get_url().host().unwrap().to_string();
         let part = format!("{}-{}", ident, hash);
@@ -417,7 +417,7 @@ impl<'a, 'b> RegistrySource<'a, 'b> {
 
         let dep = try!(Dependency::parse(name.as_slice(), Some(req.as_slice()),
                                          &self.source_id));
-        
+
         Ok(dep.optional(optional)
               .default_features(default_features)
               .features(features)
index bbb8575624762fa82c138383c0462c35446c96eb..941bf5d742d9bd1111d138c7c705a4d4ef6e8650 100644 (file)
@@ -1,7 +1,7 @@
 use std::{fmt, os, mem};
+use std::cell::{RefCell, RefMut, Ref};
+use std::collections::hash_map::{HashMap, Occupied, Vacant};
 use std::io::fs::{PathExtensions, File};
-use std::collections::HashMap;
-use std::collections::hashmap::{Occupied, Vacant};
 use std::string;
 
 use serialize::{Encodable,Encoder};
@@ -14,11 +14,11 @@ use util::toml as cargo_toml;
 
 pub struct Config<'a> {
     home_path: Path,
-    shell: &'a mut MultiShell,
+    shell: RefCell<&'a mut MultiShell>,
     jobs: uint,
     target: Option<string::String>,
-    linker: Option<string::String>,
-    ar: Option<string::String>,
+    linker: RefCell<Option<string::String>>,
+    ar: RefCell<Option<string::String>>,
     rustc_version: string::String,
     /// The current host and default target of rustc
     rustc_host: string::String,
@@ -39,11 +39,11 @@ impl<'a> Config<'a> {
                 human("Cargo couldn't find your home directory. \
                       This probably means that $HOME was not set.")
             })),
-            shell: shell,
+            shell: RefCell::new(shell),
             jobs: jobs.unwrap_or(os::num_cpus()),
             target: target,
-            ar: None,
-            linker: None,
+            ar: RefCell::new(None),
+            linker: RefCell::new(None),
             rustc_version: rustc_version,
             rustc_host: rustc_host,
         })
@@ -71,8 +71,8 @@ impl<'a> Config<'a> {
         self.home_path.join(".cargo").join("registry").join("src")
     }
 
-    pub fn shell(&mut self) -> &mut MultiShell {
-        &mut *self.shell
+    pub fn shell(&self) -> RefMut<&'a mut MultiShell> {
+        self.shell.borrow_mut()
     }
 
     pub fn jobs(&self) -> uint {
@@ -83,17 +83,17 @@ impl<'a> Config<'a> {
         self.target.as_ref().map(|t| t.as_slice())
     }
 
-    pub fn set_ar(&mut self, ar: string::String) { self.ar = Some(ar); }
-
-    pub fn set_linker(&mut self, linker: string::String) { self.linker = Some(linker); }
-
-    pub fn linker(&self) -> Option<&str> {
-        self.linker.as_ref().map(|t| t.as_slice())
+    pub fn set_ar(&self, ar: string::String) {
+        *self.ar.borrow_mut() = Some(ar);
     }
-    pub fn ar(&self) -> Option<&str> {
-        self.ar.as_ref().map(|t| t.as_slice())
+
+    pub fn set_linker(&self, linker: string::String) {
+        *self.linker.borrow_mut() = Some(linker);
     }
 
+    pub fn linker(&self) -> Ref<Option<string::String>> { self.linker.borrow() }
+    pub fn ar(&self) -> Ref<Option<string::String>> { self.ar.borrow() }
+
     /// Return the output of `rustc -v verbose`
     pub fn rustc_version(&self) -> &str {
         self.rustc_version.as_slice()
index 1807ed284640355c1888146baf9fb6e52d296991..3b4028ea6d177f7bc57eeca5012d5f0e9f56720f 100644 (file)
@@ -5,7 +5,7 @@
 //! it to figure out when a dependency should be built.
 
 use std::collections::{HashMap, HashSet};
-use std::collections::hashmap::{Occupied, Vacant};
+use std::collections::hash_map::{Occupied, Vacant};
 use std::hash::Hash;
 
 pub struct DependencyQueue<K, V> {
index 5473b0b34bc67d6781be87becc226843e4a5b6b2..3ed6cc584b6aa7b600169d7e97aa171e5ba99846 100644 (file)
@@ -1,7 +1,8 @@
 use std::fmt;
 use std::hash::Hash;
 use std::collections::{HashMap, HashSet};
-use std::collections::hashmap::{Keys, Occupied, SetItems, Vacant};
+use std::collections::hash_map::{Keys, Occupied, Vacant};
+use std::collections::hash_set::SetItems;
 
 pub struct Graph<N> {
     nodes: HashMap<N, HashSet<N>>
index 06426386ea3efd41b8c584f769214f7465d43161..a09ce2375e6a1a7483bb098e99b687480611e775 100644 (file)
@@ -26,9 +26,11 @@ elif triple == 'i686-apple-darwin':
     me = mac32
 elif triple == 'x86_64-apple-darwin':
     me = mac64
-elif triple == 'i686-w64-mingw32':
+elif triple == 'i686-pc-windows-gnu':
+    triple = 'i686-w64-mingw32'
     me = win32
-elif triple == 'x86_64-w64-mingw32':
+elif triple == 'x86_64-pc-windows-gnu':
+    triple = 'x86_64-w64-mingw32'
     me = win64
 else:
     raise Exception("no snapshot for the triple: " + triple)